package com.heima.admin.controller;

import com.heima.apis.wemedia.ManualCheckClient;
import com.heima.model.admin.dto.NewsAuthDto;
import com.heima.model.common.dtos.PageResponseResult;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/news")
public class ManualCheckController {

    @Autowired
    ManualCheckClient manualCheckClient;

    @PostMapping("/list_vo")
    public PageResponseResult getNewsListByUncheck(@RequestBody NewsAuthDto dto){
        return manualCheckClient.getNewsListByUncheck(dto);
    }

    @PostMapping("/auth_fail")
    public ResponseResult authPass(@RequestBody NewsAuthDto dto ){
        return manualCheckClient.authPass(dto);
    }

    @GetMapping("/one_vo/{id}")
    public ResponseResult adminById(@PathVariable Integer id) {
        return manualCheckClient.adminById(id);
    }

    /**
     * 审核通过
     * @param wmNews 文章id
     * @return
     */
    @PostMapping("/auth_pass")
    public ResponseResult passTheAudit(@RequestBody WmNews wmNews) {
        manualCheckClient.passTheAudit(wmNews);
        return ResponseResult.okResult(200,"审核通过");
    }


}
